package com.personal.system.controller.content.web;

import com.personal.common.result.Result;
import com.personal.system.service.content.web.ApiCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/blog/v1/collect")
@RequiredArgsConstructor
@Api(tags = "文章收藏API-V1")
public class ApiCollectController {

    private final ApiCollectService apiCollectService;

    @GetMapping(value = "/")
    @ApiOperation(value = "我的收藏列表", httpMethod = "GET", response = Result.class, notes = "我的收藏列表")
    public Result selectCollectList() {
        return apiCollectService.selectCollectList();
    }

    @GetMapping(value = "collect")
    @ApiOperation(value = "收藏文章", httpMethod = "GET", response = Result.class, notes = "收藏文章")
    public Result collect(Integer articleId) {
        return apiCollectService.collect(articleId);
    }

    @DeleteMapping(value = "/")
    @ApiOperation(value = "取消收藏", httpMethod = "DELETE", response = Result.class, notes = "取消收藏")
    public Result cancel(Integer articleId) {
        return apiCollectService.cancel(articleId);
    }
}
